#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
using namespace std;

int main()
{

	int N = 0;
	scanf("%d", &N);
	int color[10] = { 0 };
	for (int i = 0; i < N; i++)
	{
		scanf("%d", &color[i]);
	}

	int num = 0;
	scanf("%d", &num);
	int guess[5] = { 0 };
	for (int i = 0; i < num; i++)
	{
		int flag1 = 0;
		int flag2 = 1;
		for (int j = 0; j < N; j++)
		{
			scanf("%d", &guess[j]);
			if (guess[j] != 0)
			{
				flag1 = 1;
				if (guess[j] != color[j])
				{
					flag2 = 0;
				}
			}
		}
		if (flag1 == 1 && flag2 == 1)
		{
			printf("Da Jiang!!!\n");
		}
		else
		{
			printf("Ai Ya\n");
		}
	}

	return 0;
}
